﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using MxitAPI;

namespace MxitGUI {
    public partial class AddGatewayWindow : Form {
        public AddGatewayWindow() {
            InitializeComponent();
            Init();
        }

        private void Init() {
            int gatewayTypeSelectedIndex = cmbGatewayType.Items.Add( ContactType.AIM );
            cmbGatewayType.Items.Add( ContactType.GoogleTalk );
            cmbGatewayType.Items.Add( ContactType.ICQ );
            cmbGatewayType.Items.Add( ContactType.Jabber );
            cmbGatewayType.Items.Add( ContactType.MSN );
            cmbGatewayType.Items.Add( ContactType.Yahoo );
            cmbGatewayType.SelectedIndex = gatewayTypeSelectedIndex;
        }

        private void btnAddGateway_Click( object sender, EventArgs e ) {
            RegisterGatewayHandler handler = new RegisterGatewayHandler( txtUserName.Text, txtPassword.Text, ( ContactType ) cmbGatewayType.SelectedItem );
            handler.Execute();
            DialogResult = DialogResult.OK;
            Close();
        }

        private void btnCancel_Click( object sender, EventArgs e ) {
            DialogResult = DialogResult.Cancel;
            Close();
        }
    }
}
